from langchain_openai import OpenAIEmbeddings
from langchain_community.vectorstores import FAISS

from scripts.config import load_config


cfg = load_config('./config.py')
embedding = OpenAIEmbeddings(
            api_key=cfg.get('api_key'),
            base_url=cfg.get('base_url')
        )

vectorstore = FAISS.load_local(cfg.get('rag_path'), embedding, allow_dangerous_deserialization=True)

for doc_id, doc in vectorstore.docstore._dict.items():
    print(f"Doc ID: {doc_id}")
    print(f"Page content: {doc.page_content}")
    print(f"Metadata: {doc.metadata}")
    print('-' * 30)
